    <?php
    require_once "conn.php";

    if(count($_POST)>0) {
        mysqli_query($link,"UPDATE users set name='" . $_POST['name'] . "',
        mobile='" . $_POST['mobile'] . "' ,email='" . $_POST['email'] . "' WHERE id='" . $_POST['id'] . "'");
    header("location: index.php");
    exit();
    }
   $result = mysqli_query($link,"SELECT * FROM users WHERE id='" . $_GET['id']."'");
   $row= mysqli_fetch_array($result);
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head> 
<meta charset="utf-8"> 
<title>修改记录</title>
<link rel="stylesheet" href="./css/bootstrap.css">
</head>
<body>

    <div class="container"> 
        <div class="row"> 
            <div class="col-lg-12">
                <div class="my-3"> 
                    <h2>修改记录</h2> 
                </div> 
<form action=""<?php echo 
htmlspecialchars(basename($_SERVER['REQUEST_URI'])); ?> method="post"> 
           
           <div class="form-group"> 
<label for="name">姓名</label> 
<input type="text" id="name"name="name" class="form-control"  value="<?php echo $row["name"]; ?>" maxlength="50" required=""> 
        </div> 
        <div class="form-group"> 
<label for="email">邮箱</label> 
<input type="email" name="email" class="form-control" value="<?php echo $row["email"]; ?>" maxlength="30" required=""> 
</div> 
<div class="form-group"> 
<label for="mobile">电话号码</label> 
<input type="mobile" name="mobile" class="form-control" value="<?php echo $row["mobile"]; ?>" maxlength="12"required=""> 
</div>
<input type="hidden" name="id" value="<?php echo $row["id"]; ?>"/> 
<input type="submit" class="btn btn-primary" value="修改"> 
<a href="index.php" class="btn btn-success">返回首页</a> 
</form> 
</div> 
</div> 
</div> 
</body> 
</html>